翻訳と辞書
Words near each other
・ Test stamp
・ Test Stand VII
・ Test statistic
・ Test strategy
・ Test strip
・ Test stub
・ Test Studio
・ Test subject
・ Test suite
・ Test target
・ Test Template Framework
・ Test the Nation
・ Test the Store
・ Test theories of special relativity
・ Test and learn
Test and test-and-set
・ Test and Training Enabling Architecture
・ Test and Training Range
・ Test and validation centre, Wegberg-Wildenrath
・ Test anxiety
・ Test Anything Protocol
・ Test article
・ Test assertion
・ Test automation
・ Test automation management tools
・ Test Ban Treaty
・ Test bench
・ Test call generator
・ Test card
・ Test Card F


Dictionary Lists
翻訳と辞書 辞書検索 [ 開発暫定版 ]
スポンサード リンク

Test and test-and-set : ウィキペディア英語版
Test and test-and-set
In computer science, the test-and-set CPU instruction is used to implement
mutual exclusion in multiprocessor environments. Although a correct lock can be implemented with test-and-set, it can lead to resource contention in busy lock (caused by bus locking and cache invalidation when test-and-set operation needs to access memory atomically).
To lower the overhead a more elaborate locking protocol test and test-and-set
is used. The main idea is ''not'' to spin in test-and-set but increase the likelihood of successful test-and-set by using the following entry protocol to the lock:
''boolean'' locked := false ''// shared lock variable''
procedure EnterCritical()
Exit protocol is:
procedure ExitCritical()
The entry protocol uses normal memory reads to spin, waiting for the lock to become free. Test-and-set is only used to try to get the lock when normal memory read says it's free. Thus the expensive atomic memory operations happens less often than in simple spin around test-and-set.
If the programming language used supports short-circuit evaluation, the entry protocol could be implemented as:
procedure EnterCritical()
==Caveat==
Although this optimization is useful in system programming it should be avoided in high level concurrent programming unless all constraints are clear and understood. One example of bad usage is a similar idiom called double-checked locking, which, under certain conditions, can be an anti-pattern.〔David Bacon et al. (The "Double-Checked Locking is Broken" Declaration ).〕

抄文引用元・出典: フリー百科事典『 ウィキペディア(Wikipedia)
ウィキペディアで「Test and test-and-set」の詳細全文を読む



スポンサード リンク
翻訳と辞書 : 翻訳のためのインターネットリソース

Copyright(C) kotoba.ne.jp 1997-2016. All Rights Reserved.